Field of the Invention
Apparatuses and methods consistent with the present invention relate to a processor and a control method thereof, and more particularly, to a processor and a control method thereof, for processing an interrupt service.
Description of the Related Art
An electronic apparatus executes an application program to perform a specific function. The application program is a service routine containing consecutive instructions, and a processor of an electronic apparatus processes consecutive instructions. The processor sequentially processes consecutive instructions. However, the application program may include an interrupt service routine as necessary. The interrupt service routine may be executed according to generation of an event that is set during processing of a main service routine. When interrupt occurs, the processor stops processing of the main service routine and processes the interrupt service routine. The processor needs to use a register in the processor in order to process the interrupt service routine. However, the processor may now know a register to be used at a time point when the interrupt service routine is started. Accordingly, the processor stores data stored in all registers in a memory and then processes the interrupt service routine. In addition, when the interrupt service routine is terminated, the processor restores data stored in the memory back to all registers. Accordingly, a long period of time is taken to process the interrupt service routine.